package com.ngmaster.socket.callback;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

/**
 * 心跳回调
 * */
public class CallbackHeartbeat implements Callback {

    private static Logger logger = LoggerFactory.getLogger(CallbackHeartbeat.class);

    @Override
    public void onFailure(Call call, IOException e) {
        logger.error("[heartbeat callback fail]", e);
    }

    @Override
    public void onResponse(Call call, Response response) throws IOException {
        logger.info("[heartbeat callback:{}]", response.body().string());
    }
}
